package edu.uoc.tdp.pac3.beans;

import java.util.Date;

/**
 * Classe que representa una area
 * 
 * @author Eloi Rebollo i Francesc Cabrera
 * @version 1.0
 */
public class Area implements java.io.Serializable {

    private Integer idArea;
    private String nameArea;
    private Date creationDate;

    public Area(Integer idArea, String nameArea, Date creationDate) {
        this.idArea = idArea;
        this.nameArea = nameArea;
        this.creationDate = creationDate;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Integer getIdArea() {
        return idArea;
    }

    public void setIdArea(Integer idArea) {
        this.idArea = idArea;
    }

    public String getNameArea() {
        return nameArea;
    }

    public void setNameArea(String nameArea) {
        this.nameArea = nameArea;
    }

    public boolean equals(Object obj) {
        boolean igual = false;
        if (obj != null) {
            if (obj instanceof Area) {
                igual = this.getIdArea().equals(((Area) obj).getIdArea());
            }
        }
        return igual;
    }

    @Override
    public String toString() {
        StringBuffer cadena = new StringBuffer();
        
        cadena.append(getIdArea().toString() + "\t");
        cadena.append(getNameArea() + "\t");
        cadena.append(getCreationDate().toString() + "\t");
        
        return cadena.toString();
    }
    
    
}
